new Vue({
	el: "body",
	data: {
		if_pay: false,
		shopimg: "",
		shopname: "",
		products_data: [],
		sendprice: "",
		count: "",
		totle: "",
		actprice: "",
		username: "",
		user_phonenum: "",
		indexadress: "",
		buy_time: "",
		shopid:""
	},
	created: function() {
		var orderid = geturl_ch('id');
		this.leancloudInit();
		this.findorder(orderid);
	},
	methods: {
		backpage: function() {
			var zt = geturl_ch('zt');
			console.log(zt);
			if(zt == "1") {
				location.href="../index/index.html";
			} else if(zt == "2") {
				history.back();
			}
		},
		leancloudInit: function() {
			var APP_ID = 'c4w6bVvWfh8xxcmkBE1G0gIt-gzGzoHsz';
			var APP_KEY = 'JBikg4Ksk76zcTi5BKYWvTJF';
			AV.init({
				appId: APP_ID,
				appKey: APP_KEY
			});
		},
		findorder: function(orderid) {
			//根据距离筛选商家
			var _this = this;
			var query = new AV.Query('ELM_order');
			query.get(orderid).then(function(data) {
				// 成功获得实例
				_this.shopid = data.attributes.shopid;
				_this.if_pay = data.attributes.if_pay;
				_this.shopimg = '../index/'+data.attributes.shopimg;
				_this.shopname = data.attributes.shop_name;
				_this.products_data = data.attributes.products_data;
				_this.sendprice = data.attributes.shop_sendprice;
				_this.count = data.attributes.total;
				_this.totle = (data.attributes.totle) * 1 + (data.attributes.shop_sendprice) * 1;
				_this.actprice = data.attributes.actprice;
				_this.username = data.attributes.username;
				_this.user_phonenum = data.attributes.user_phonenum;
				_this.indexadress = data.attributes.indexadress;
				_this.buy_time = data.attributes.buy_time;
				console.log(_this.if_pay);
			}, function(error) {
				// 异常处理
			})
		},
		tzshop:function(){
			var id=this.shopid;
			location.href = "../shopdata/shopdata.html?shopid=" + seturl(id);
		}
	}
})